const {ipcMain}=require('electron')
const {send:sendMainwindow}=require('./windows/main')
const {create:createControlwindow}=require('./windows/control')

module.exports=function(){
  ipcMain.handle('login',async ()=>{
    let code=Math.floor(Math.random()*(999999-100000)+100000)
    return code
  })
  ipcMain.on('control',async (e,remoteCode)=>{
    sendMainwindow('control-state-change',remoteCode,1)
    createControlwindow()
  })
}


